package com.example.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by James-Yin on 2018/7/25.
 */
@RestController
@RefreshScope //config server刷新时, 对应的参数也会刷新
@RequestMapping("/config")
public class ConfigClientController {
    
	@Value("${simple.config.name}")
    private String name;
	
	@Value("${simple.config.age}")
    private String age;

    
    @RequestMapping("/configDemo")
    public String getSentence() {
    	String returnstr = "姓名：" + name + ", 年龄: " + age;
    	System.out.println(returnstr);
        return returnstr;
    }
}
